home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
asmsrc
/
phagexsources.lha
/
source
/
PalPlasma.s
< prev
next >
Wrap
Text File
|
1994-07-09
|
9KB
|
571 lines
; Just a quick modification of some old PMC code.
Opt c-
Section "Base Code",Code_c
PlasmaColour = $c0000
CopperList0 = $c2000
CopperList1 = $d0000
Lines = 256
IncDir Df1:
Start Movem.l d0-d7/a0-a6,-(sp)
Bsr KillSys
Lea CopperList0,a0
Lea HardWare,a6
Move.l a0,Cop1Lc(a6)
Move.w #$83c0,DMACon(a6)
Lea CopperList0,a0
Lea CopperList1,a1
Move.l #$1000200,(a0)+
Move.l #$1000200,(a1)+
Move.l #$3001fffe,d0
Move.w #Lines-1,d6
SetColLoop1 Move.l d0,(a0)+
Move.l d0,(a1)+
Move.w #44,d7
SetColLoop2 Move.l #$01800000,(a0)+
Move.l #$01800000,(a1)+
Dbf d7,SetColLoop2
Cmp.l #$ffe1fffe,d0
Beq Poo2
Add.l #$1000000,d0
Move.l d0,d1
Swap d1
Asr.w #8,d1
Cmp.b #$ff,d1
Bne Poo
Move.l #$ffe1fffe,d0
Bra Poo
Poo2 Move.l #$0001fffe,d0
Poo Dbf d6,SetColLoop1
Move.l #$fffffffe,(a0)+
Move.l #$fffffffe,(a1)+
Bsr DoRGBSine
Loop Bsr VBL
Bsr DoubleBuffer
Bsr DoWobble
Bsr DoPlasma
Btst #6,$Bfe001
Bne Loop
Bsr ReturnSys
Movem.l (sp)+,d0-d7/a0-a6
Moveq #0,d0
Rts
DoubleBuffer Lea CopperPt(pc),a0
Move.l 0(a0),d0
Move.l 4(a0),d1
Move.l d0,4(a0)
Move.l d1,0(a0)
Move.l d0,$Dff080
Rts
DoRGBSine Move.w #0,d2
Lea PlasmaColour,a0
RGBSineLoop Lea RedSine(pc),a2
Bsr SineWave
Move.w d4,0(a0)
Lea GreenSine(pc),a2
Bsr SineWave
Asl.w #4,d4
Move.w d4,2(a0)
Lea BlueSine(pc),a2
Bsr SineWave
Asl.w #8,d4
Move.w d4,4(a0)
Move.w #0,6(a0)
Addq #8,a0
Add.w #1,d2
Cmp.w #810,d2
Bne RGBSineLoop
Rts
SineWave Movem.l d0-d3/a0-a1,-(sp)
Lea SineData(pc),a0
Move.l 00(a2),d0
Move.l 04(a2),d1
Move.l 08(a2),d2
Move.l 12(a2),d3
And.l #$7fe,d0
And.l #$7fe,d1
And.l #$1fe,d2
And.l #$1fe,d3
Add.l d2,d0
Add.l d3,d1
Move.l d0,0(a2)
Move.l d1,4(a2)
Move.w (a0,d0),d4
Add.w (a0,d1),d4
Add.l #512,d4
Asr.w #6,d4
And.w #$f,d4
Movem.l (sp)+,d0-d3/a0-a1
Rts
DoWobble Move.l WobbleSine0(pc),d0
Move.l WobbleSine1(pc),d1
Move.l WobbleSine2(pc),d2
Move.l WobbleSine3(pc),d3
Lea PlasmaSine(pc),a4
Lea PlasmaSine+$100(pc),a5
Move.l a4,d4
Move.l a5,d5
Move.l #$100,d7
Lea WobbleSine0Pt(pc),a1
Lea WobbleSine1Pt(pc),a2
Add.l d0,(a1)
Cmp.l (a1),d5
Bhi FindSine1
Sub.l d7,(a1)
Bra FoundSine1
FindSine1 Cmp.l (a1),d4
Bls FoundSine1
Add.l d7,(a1)
FoundSine1 Add.l d1,(a2)
Cmp.l (a2),d5
Bhi FindSine2
Sub.l d7,(a2)
Bra FoundSine2
FindSine2 Cmp.l (a2),d4
Bls FoundSine2
Add.l d7,(a2)
FoundSine2 Move.l CopperPt(pc),a0
Add.l #$5,a0
Move.l WobbleSine0Pt(pc),a1
Move.l WobbleSine1Pt(pc),a2
Lea $100,a3
Move.w #Lines-1,d0
Move.l #$b8,d1
Moveq.l #1,d4
Moveq.l #0,d6
Moveq.l #$57,d7
DoWobbleLoop Add.l d2,a1
Cmp.l d5,a1
Bcs EndWobTab
Sub.l a3,a1
EndWobTab Add.l d3,a2
Cmp.l d5,a2
Bcs SetWobble
Sub.l a3,a2
SetWobble Move.b (a1),d6
Add.b (a2),d6
Lsr.b d4,d6
Lsl.b d4,d6
Add.b d7,d6
Move.b d6,(a0)
Add.l d1,a0
Dbra d0,DoWobbleLoop
Rts
DoPlasma Move.l PlasmaSine0(pc),d0
Move.l PlasmaSine1(pc),d4
Move.l PlasmaSine2(pc),d1
Move.l PlasmaSine3(pc),d5
Move.l PlasmaSine4(pc),d2
Move.l PlasmaSine5(pc),d6
Move.l PlasmaSine6(pc),d3
Move.l PlasmaSine7(pc),d7
Lea PlasmaSine0Pt(pc),a0
Lea PlasmaSine1Pt(pc),a1
Lea PlasmaSine2Pt(pc),a2
Lea PlasmaSine3Pt(pc),a3
Lea PlasmaColour,a4
Lsl.l #1,d0
Lsl.l #1,d1
Lsl.l #1,d2
Lsl.l #1,d3
Lsl.l #1,d4
Lsl.l #1,d5
Lsl.l #1,d6
Lsl.l #1,d7
Add.l d0,(a0)
Cmp.l #PlasmaSine+$2040,(a0)
Bcs GetRedSine
Sub.l #$1f40,(a0)
Bra.s GotRedSine
GetRedSine Cmp.l #PlasmaSine+$100,(a0)
Bcc GotRedSine
Add.l #$1f40,(a0)
GotRedSine Add.l d1,(a1)
Cmp.l #PlasmaSine+$2040,(a1)
Bcs GetGreenSine
Sub.l #$1f40,(a1)
Bra.s GotGreenSine
GetGreenSine Cmp.l #PlasmaSine+$100,(a1)
Bcc GotGreenSine
Add.l #$1f40,(a1)
GotGreenSine Add.l d2,(a2)
Cmp.l #PlasmaSine+$2040,(a2)
Bcs GetBlueSine
Sub.l #$1f40,(a2)
Bra.s GotBlueSine
GetBlueSine Cmp.l #PlasmaSine+$100,(a2)
Bcc GotBlueSine
Add.l #$1f40,(a2)
GotBlueSine Add.l d3,(a3)
Cmp.l #PlasmaSine+$2040,(a3)
Bcs SinesFound
Sub.l #$1f40,(a3)
Bra.s SetNewSine
SinesFound Cmp.l #PlasmaSine+$100,(a3)
Bcc SetNewSine
Add.l #$1f40,(a3)
SetNewSine Move.l (a0),a0
Move.l (a1),a1
Move.l (a2),a2
Move.l (a3),a3
Move.l CopperPt(pc),d2
Add.l #$a,d2
Move.l a4,d3
Bsr WaitBlitter
Move.w #6,$Dff064
Move.w #6,$Dff062
Move.w #6,$Dff060
Move.w #$b6,$Dff066
Move.l #-1,$Dff044
Move.w #$ffe,$Dff040
Move.w #0,$Dff042
Move.l a6,-(sp)
Lea XCount(pc),a6
Move.w #0,(a6)
Move.l (sp)+,a6
CheckSine1 Add.l d4,a0
Cmp.l #PlasmaSine+$2040,a0
Bcs CheckSine2
Sub.l #$1f40,a0
CheckSine2 Add.l d5,a1
Cmp.l #PlasmaSine+$2040,a1
Bcs CheckSine3
Sub.l #$1f40,a1
CheckSine3 Add.l d6,a2
Cmp.l #PlasmaSine+$2040,a2
Bcs CheckSine4
Sub.l #$1f40,a2
CheckSine4 Add.l d7,a3
Cmp.l #PlasmaSine+$2040,a3
Bcs SetRGBBlit
Sub.l #$1f40,a3
SetRGBBlit Moveq.l #0,d0
Move.w (a0),d0
Move.w (a1),d1
Add.w d1,d0
Lsr.w #1,d0
Lsl.w #3,d0
Move.l d3,a4
Add.l #2,d3
Add.l d0,a4
Move.w (a1),d0
Move.w (a2),d1
Add.w d1,d0
Lsr.w #1,d0
Lsl.w #3,d0
Move.l d3,a5
Add.l #2,d3
Add.l d0,a5
Move.w (a2),d0
Move.w (a3),d1
Add.w d1,d0
Lsr.w #1,d0
Lsl.w #3,d0
Move.l d3,a6
Add.l #2,d3
Add.l d0,a6
Bsr WaitBlitter
Move.l a4,$Dff050
Move.l a5,$Dff04c
Move.l a6,$Dff048
Move.l d2,$Dff054
Move.w #(Lines*64)+1,$Dff058
Sub.l #6,d3
Add.l #4,d2
Move.l a6,-(sp)
Lea XCount(pc),a6
Add.w #1,(a6)
Move.w (a6),d0
Move.l (sp)+,a6
Cmp.w #$10,d0
Bne CheckSine1
Bsr WaitBlitter
Rts
WaitBlitter Btst #$6,$Dff002
Bne WaitBlitter
Rts
VBL Move.l $Dff004,d0
And.l #$1ff00,d0
Cmp.l #$13000,d0
Bne VBL
Rts
KillSys Bsr.s SysWait
Move.l $4,a6
Lea GFXName(pc),a1
Moveq #0,d0
Jsr -552(a6)
Lea OldCop1(pc),a5
Move.l $26(a0),$0(a5)
Move.l $32(a0),$4(a5)
Lea HardWare,a6
Move.w IntEnaR(a6),d0
Move.w DMAConR(a6),d1
Or.w #$8000,d0
And.w #$03ff,d1
Or.w #$8000,d1
Move.w d0,$8(a5)
Move.w d1,$a(a5)
Move.w #$7fff,IntEna(a6)
Move.w #$7fff,DMACon(a6)
Rts
SysWait Move.w #15,d7
SysWaitLoop Move.l #$05000,d1
Bsr.s WaitVBL
Bsr.s DoWaitVBL
Dbf d7,SysWaitLoop
Rts
DoWaitVBL Move.l #$03000,d1
WaitVBL Movem.l d0-d1/a6,-(sp)
Lea HardWare,a6
WaitVBLLoop Move.l VPosR(a6),d0
And.l #$1ff00,d0
Cmp.l d1,d0
Bne.s WaitVBLLoop
Movem.l (sp)+,d0-d1/a6
Rts
ReturnSys Lea HardWare,a6
Move.w OldIntEna(pc),IntEna(a6)
Move.w OldDMACon(pc),DMACon(a6)
Move.l OldCop1(pc),Cop1lc(a6)
Move.l OldCop2(pc),Cop2lc(a6)
Rts
GFXName Dc.b "graphics.library",0
Even
OldCop1 Dc.l 0
OldCop2 Dc.l 0
OldIntEna Dc.w 0
OldDmaCon Dc.w 0
Screen Dc.l $c0000
XCount Dc.w 0
RedSine Dc.l 8
Dc.l 2
Dc.l 12
Dc.l 6
GreenSine Dc.l 4
Dc.l 4
Dc.l 8
Dc.l 14
BlueSine Dc.l 2
Dc.l 2
Dc.l 14
Dc.l 6
WobbleSine0 Dc.l 1
WobbleSine1 Dc.l 3
WobbleSine2 Dc.l 2
WobbleSine3 Dc.l 1
WobbleSine0Pt Dc.l PlasmaSine
WobbleSine1Pt Dc.l PlasmaSine
CopperPt Dc.l CopperList0
CopperPt1 Dc.l CopperList1
PlasmaSine0 Dc.l 34
PlasmaSine1 Dc.l 22
PlasmaSine2 Dc.l 16
PlasmaSine3 Dc.l 48
PlasmaSine4 Dc.l 12
PlasmaSine5 Dc.l 24
PlasmaSine6 Dc.l 32
PlasmaSine7 Dc.l 14
PlasmaSine0Pt Dc.l PlasmaSine+$100
PlasmaSine1Pt Dc.l PlasmaSine+$100
PlasmaSine2Pt Dc.l PlasmaSine+$100
PlasmaSine3Pt Dc.l PlasmaSine+$100
TabVar1 Dc.l 0
TabVar2 Dc.l 0
TabVar3 Dc.l 0
TabVar4 Dc.l 0
TabVar5 Dc.l 0
TabVar6 Dc.l 0
TabVar7 Dc.l 0
TabVar8 Dc.l 0
Cmv Macro
Dc.w \2,\1
EndM
Cwt Macro
Dc.w (\1*$100)+$01,$fffe
EndM
Pal Macro
Dc.w $ffe1,$fffe
EndM
EndCop Macro
Dc.w $ffff,$fffe
EndM
PlasmaSine Incbin df0:SysData/PMC.Sine1
SineData Incbin df0:SysData/Sine1024Bs.Dat
Incbin df0:SysData/Sine1024Bs.Dat
****Custom Chip Registers****
Hardware = $Dff000
;Control Registers
Dmaconr = $002
Vposr = $004
Vhposr = $006
Joy0dat = $00A
Joy1dat = $00C
Clxdat = $00E
Intenar = $01C
Intereqr = $01E
Copcon = $02E
;Blitter Registers
Bltcon0 = $040
Bltcon1 = $042
Bltafwm = $044
Bltalwm = $046
Bltcpth = $048
Bltcptl = $04A
Bltbpth = $04C
Bltbptl = $04E
Bltapth = $050
Bltaptl = $052
Bltdpth = $054
Bltdptl = $056
Bltsize = $058
Bltcmod = $060
Bltbmod = $062
Bltamod = $064
Bltdmod = $066
Bltcdat = $070
Bltbdat = $072
Bltadat = $074
;Copper Registers
Cop1lc = $080
Cop1lch = $080
Cop1lcl = $082
Cop2lc = $084
Cop2lch = $084
Cop2lcl = $086
Copjmp1 = $088
Copjmp2 = $08A
Diwstrt = $08E
Diwstop = $090
Ddfstrt = $092
Ddfstop = $094
Dmacon = $096
Clxcon = $098
Intena = $09A
Intreq = $09C
;BitPlane Registers
BplCon0 = $100
BplCon1 = $102
BplCon2 = $104
BplMod1 = $108
BplMod2 = $10a
BplPt0h = $0e0
BplPt0l = $0e2
BplPt1h = $0e4
BplPt1l = $0e6
BplPt2h = $0e8
BplPt2l = $0ea
BplPt3h = $0ec
BplPt3l = $0ee
BplPt4h = $0f0
BplPt4l = $0f2
BplPt5h = $0f4
BplPt5l = $0f6
;Colour Registers
Color00 = $180
Color01 = $182
Color02 = $184
Color03 = $186
Color04 = $188
Color05 = $18a
Color06 = $18c
Color07 = $18e
Color08 = $190
Color09 = $192
Color10 = $194
Color11 = $196
Color12 = $198
Color13 = $19a
Color14 = $19c
Color15 = $19e
Color16 = $1a0
Color17 = $1a2
Color18 = $1a4
Color19 = $1a6
Color20 = $1a8
Color21 = $1aa
Color22 = $1ac
Color23 = $1ae
Color24 = $1b0
Color25 = $1b2
Color26 = $1b4
Color27 = $1b6
Color28 = $1b8
Color29 = $1ba
Color30 = $1bc
Color31 = $1be
EcsNop = $1fe